import java.util.Scanner;

/**
 * @author gao
 * @date 2025/6/25 15:01
 */
class ListNode {
    int val;
    ListNode next;

    public ListNode() {
    }

    public ListNode(int val) {
        this.val = val;
    }

    public ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }
}

public class Solution {
    public ListNode reverseList(ListNode head) {
        if(head ==null) {
            return null;
        }
        if(head.next ==null) {
            return head;
        }

        ListNode cur = head.next;
        head.next =null;
        while(cur !=null) {
            ListNode curNext = cur.next;
            cur.next = head;
            head = cur;
            cur = curNext;
        }
        return head;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int len = in.nextInt();
            ListNode head = null;
            ListNode tail = null;
            for (int i = 0; i < len; i++) {
                int val = in.nextInt();
                ListNode newNode = new ListNode(val);
                if (head == null) {
                    head = newNode;
                    tail = newNode;
                } else {
                    tail.next = newNode;
                    tail = newNode;
                }
            }
            Solution solution = new Solution();
            Print(solution.reverseList(head));
        }
    }

    public static void Print(ListNode head) {
        ListNode cur = head;
        while (cur != null) {
            System.out.print(cur.val + " ");
            cur = cur.next;
        }
    }
}